package com.qfedu.util;

import java.util.List;

/**
 * projectName: logistics
 * author: CGY
 * time: 2020/10/9 20:38
 * description:
 */
public class ResultUtil {
    public static Result getObject(Object data,String msg){

        if(data instanceof Integer){
            Integer num = (Integer)data;
            if(num <= 0 ){
                return Result.error(msg);
            }else{
                return Result.success(data);
            }
        }else if(data instanceof List){
            List list  = (List)data;
            if(list == null || list.size() <=0){
                return Result.error(msg);
            }else{
                return Result.success(data);
            }
        }else{
            if(data == null){
                return Result.error(msg);
            }
            return Result.success(data);
        }
    }
}
